﻿package ${clazz.package.name}
{
<#if importClassNameList ??><#list importClassNameList as t>	import ${t};
</#list></#if>
<#if xclass ??>	${xclass.doc.toString()}</#if>
	public class ${clazz.simpleName} extends DefaultServiceProxy
	{
    	private static const SERVICE_NAME:String = "${remotingDestinationName}";

  		public function ${clazz.simpleName}() {
     		super(SERVICE_NAME);
			<#--
     		var user:User = new User();
         	user.username = "kermit";

			this._userContext = new UserContext();
     		this._userContext.user = user;
     		-->
  		}
		<#--
		private var _userContext:UserContext;
		
		public function get userContext():UserContext
		{
			return _userContext;
		}

		public function set userContext(value:UserContext):void
		{
			_userContext = value;
		}
		 -->
  		<#if methodObjects ??><#list methodObjects as methodObject><#assign method=methodObject.method>
  		<#if methodObject.xmethod ??><#assign xmethod=methodObject.xmethod><#assign xparameters=xmethod.parameters>

		${xmethod.doc.toString()}
		public function 
			/* flex: ${getActionScriptTypeName(method.returnType)} */ 
			/* java: ${getJavaTypeComment(method.returnType)} */
		${method.name}(<#if method.genericParameterTypes ??><#list method.genericParameterTypes as t>
 			${xparameters[t_index].name}:${getGenericActionScriptTypeName(t, method.parameterTypes[t_index])},</#list></#if>
 			callback:Function = null,
 			context:Object = null
 			):void {
    		callService("${method.name}", <#if method.genericParameterTypes ??>[<#list method.genericParameterTypes as t>${xparameters[t_index].name}<#if t_has_next>, </#if></#list>]<#else>null</#if>, callback, context);
 		}
 		<#else>

 		public function ${method.name}(<#if method.genericParameterTypes ??><#list method.genericParameterTypes as t>
 			p${t_index}:${getGenericActionScriptTypeName(t, method.parameterTypes[t_index])},</#list></#if>
 			callback:Function = null,
 			context:Object = null
 			):void {
    		callService("${method.name}", <#if method.genericParameterTypes ??>[<#list method.genericParameterTypes as t>p${t_index}<#if t_has_next>, </#if></#list>]<#else>null</#if>, callback, context);
 		}
 		</#if>
 		</#list></#if>
	}
}